# Maintainer:
pkgname=py3-tqdm
_pkgname=tqdm
pkgver=4.66.1
pkgrel=0
pkgdesc="Fast, Extensible Progress Meter"
url="https://pypi.org/project/tqdm"
arch="noarch"
license="MIT"
depends="python3"
makedepends="py3-setuptools py3-setuptools_scm py3-gpep517 py3-wheel py3-installer"
checkdepends="py3-pandas py3-pytest py3-pytest-asyncio py3-pytest-timeout"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-tqdm" # Backwards compatibility
provides="py-tqdm=$pkgver-r$pkgrel" # Backwards compatibility

prepare() {
	default_prepare
	case "$CARCH" in
		# FIXME: remove selected failing tests on selected arches
		aarch64) rm tests/tests_perf.py;;
		s390x) rm tests/tests_perf.py;;
		x86) rm tests/tests_synchronisation.py;;
	esac
}

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION="$pkgver"
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	# 30s timeout
	pytest -k 'not test_lock_args'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	ln -s tqdm "$pkgdir"/usr/bin/tqdm-3
}

sha512sums="
989bc93f791e1636525486688b1d9b457314cde7b5804018382cc490638ac0b88aac50d7870beb9dd80bc5f05e083b8f9f205ac17324106f6d936bfe8d2f316e  tqdm-4.66.1.tar.gz
"
